﻿using Janus.BaseEntitys;
using Janus.Cores.Extension;
using Janus.Cores.Linq;
using Janus.Mes.DTO;
using Janus.Mes.Services.Interface;
using Janus.Mes.VO;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Web.Mvc;

namespace Janus.Mes.WebClient.Areas.BaseData.Controllers.EMTItem
{
    public class EMTItemController : BaseController
    {
       
        public ActionResult Index()
        {
            return View();
        }
        public ActionResult Create()
        {
            return View();
        }

        #region 私有方法
        protected IEnumerable<ComputationUnitVO> GetList(FormCollection collection)
        {
            var searchParma = base.SearchPara<ComputationUnitDTO>(collection);
            if (searchParma.Model.UnitCode.IsNotEmpty())
            {
                searchParma.Queriers.Where("UnitCode.Contains({@0})", searchParma.Model.UnitCode);
            }
            if (searchParma.Model.UnitName.IsNotEmpty())
            {
                searchParma.Queriers.Where("UnitName.Contains({@0})", searchParma.Model.UnitName);
            }

            var result = base.FindAll<ComputationUnitDTO>(searchParma, ComputationUnitServices);
            if (!result.ErrorMessage.IsNotEmpty())
            {
                var list = result.Result.ToEntitys<ComputationUnitVO>();// AutoMapper.Mapper.DynamicMap<List<ComputationUnitVO>>(result.Result);
                return list;
            }
            else
            {
                return new List<ComputationUnitVO>();
            }
        }
        #endregion
        public ActionResult Select()
        {
            return View();
        }
        public ActionResult Details()
        {
            return View();
        }
    }
}